package org.gpp.proj1.util.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class FileStringExtractor {

	/**
	 * Reads the data from a file and appends
	 * it to a string
	 * 
	 * @param file
	 * @return The string with the file's contents
	 * 
	 * @throws IOException 
	 */
	public static String readFile( File file ) throws IOException { 

		String dataString = "";
		BufferedReader reader = new BufferedReader( new FileReader( file ) );
		
		String line;
		while( (line = reader.readLine()) != null ) {
			dataString += line + "\n";
		}
		
		return dataString;	
	}
}
